package com.apptest.android.ui.architecture;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.apptest.android.core.bean.ArchitectureBean;
import com.apptest.android.core.bean.NavigationTagBean;
import com.apptest.android.core.network.ApiEngine;
import com.apptest.android.core.network.BaseObserver;

import java.util.List;

public class ArchitectureViewModel extends ViewModel {

    private MutableLiveData<List<ArchitectureBean>> architectureBeanList;

    public ArchitectureViewModel() {
        architectureBeanList = new MutableLiveData<>();
        updateArchitectureList();
    }

    public LiveData<List<ArchitectureBean>> getArchitectureList() {
        return architectureBeanList;
    }

    public void updateArchitectureList(){
        ApiEngine.getArchitectureTreeData(new BaseObserver<List<ArchitectureBean>>() {
            @Override
            public void onSuccess(List<ArchitectureBean> treeData) {
                architectureBeanList.setValue(treeData);
            }
        });
    }

}